/**
 * 
 */
package data;

import java.io.File;

/**
 * Represents a job for a file to rename.
 * 
 * @author Kevin Wagner
 * @version 1.0
 */
public class Task {

	private File file;
	private String inputPattern = "%NAME%";
	private String outputPattern = "%NAME%";
	private String inputFileName;
	private String outputFileName;
	private String suffix;

	/**
	 * Creates a new task for the given file.
	 * 
	 * @param file
	 *            the file to rename
	 */
	public Task(File file) {
		this.file = file;
		inputFileName = file.getName();
		outputFileName=inputFileName;
		if (outputFileName.indexOf(46) == -1) {
			setSuffix("");
		} else {
			setSuffix(outputFileName.substring(outputFileName.lastIndexOf(46)));
			inputFileName = inputFileName.substring(0,
					inputFileName.lastIndexOf(46));
		}
		outputFileName=inputFileName;
	}

	/**
	 * @return the input file name without suffix
	 */
	public String getInputFileName() {
		return inputFileName;
	}

	/**
	 * @return the file of the task
	 */
	public File getFile() {
		return file;
	}

	/**
	 * @return the pattern for the input file name without suffix
	 */
	public String getInputPattern() {
		return inputPattern;
	}

	/**
	 * @param inputPattern
	 *            the new pattern for the input file name without suffix
	 */
	public void setInputPattern(String inputPattern) {
		this.inputPattern = inputPattern;
	}

	/**
	 * @return the pattern for the output file name without suffix
	 */
	public String getOutputPattern() {
		return outputPattern;
	}

	/**
	 * @param outputPattern
	 *            the new pattern for the output file name without suffix
	 */
	public void setOutputPattern(String outputPattern) {
		this.outputPattern = outputPattern;
	}

	/**
	 * @return the output file name without suffix
	 */
	public String getOutputFileName() {
		return outputFileName;
	}

	/**
	 * @param outputFileName
	 *            the new output file name without suffix
	 */
	public void setOutputFileName(String outputFileName) {
		this.outputFileName = outputFileName;
	}

	/**
	 * @return the suffix
	 */
	public String getSuffix() {
		return suffix;
	}

	/**
	 * @param suffix
	 *            the new suffix
	 */
	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}

}
